package Screens;

import Utils.SoundManager;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.acumenvn.pent.MyPent;

public class AboutScreen implements Screen {
	Texture mTexture;
	Sprite mSprite;
	SpriteBatch mBatch;
	Sound mClickSound;
	
	MyPent mGame;
	InputProcessor mInputP = new InputProcessor() {
		
		@Override
		public boolean touchUp(int screenX, int screenY, int pointer, int button) {
			// TODO Auto-generated method stub
			return false;
		}
		
		@Override
		public boolean touchDragged(int screenX, int screenY, int pointer) {
			// TODO Auto-generated method stub
			return false;
		}
		
		@Override
		public boolean touchDown(int screenX, int screenY, int pointer, int button) {
			// TODO Auto-generated method stub
			return false;
		}
		
		@Override
		public boolean scrolled(int amount) {
			// TODO Auto-generated method stub
			return false;
		}
		
		@Override
		public boolean mouseMoved(int screenX, int screenY) {
			// TODO Auto-generated method stub
			return false;
		}
		
		@Override
		public boolean keyUp(int keycode) {
			// TODO Auto-generated method stub
			return false;
		}
		
		@Override
		public boolean keyTyped(char character) {
			// TODO Auto-generated method stub
			return false;
		}
		
		@Override
		public boolean keyDown(int keycode) {
			// TODO Auto-generated method stub
			if(keycode == Keys.ENTER) {
				mGame.setScreen(new MainMenuScreen(mGame));
				SoundManager.getInstance().playSound(mClickSound);
			}
			return false;
		}
	};
	
	public AboutScreen(MyPent game) {
		// TODO Auto-generated constructor stub
		this.mGame = game;
	}
	
	
	@Override
	public void render(float delta) {
		// TODO Auto-generated method stub
		Gdx.graphics.setContinuousRendering(true);
		Gdx.graphics.requestRendering();
		Gdx.gl20.glClearColor(0, 0, 0, 1);
		Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);
	
		mBatch.begin();
		mSprite.draw(mBatch);
		mBatch.end();
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		mTexture = new Texture("Images/About.png");
		mTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
		
		mSprite = new Sprite(mTexture);
		mSprite.setOrigin(mSprite.getWidth()/2, mSprite.getHeight()/2);
		mSprite.setPosition(0, 0);
		
		mBatch = new SpriteBatch();
		Gdx.graphics.setContinuousRendering(false);
		Gdx.graphics.requestRendering();
		Gdx.input.setInputProcessor(mInputP);
		
		mClickSound = SoundManager.getInstance().getSoundSelectMenu();
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		mTexture.dispose();
		
	}
	

}
